// tester_merge.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	char result_filename[200];
	strcpy(result_filename,"result.txt");
	FILE *result_file;
	result_file=fopen(result_filename,"wt");
	if(!result_file) {printf("Can't create resulting file",result_filename);exit(1);}
	fprintf(result_file,"Testing file %s, lab %s, task %s, report %s \n",argv[1],argv[2],argv[3],argv[4]);
	char path_to_test[300];
	sprintf(path_to_test,".\\%s\\%s\\%s",argv[2],argv[3],argv[4]);
	char main_test[120];
	sprintf(main_test,"tests.tst");
	FILE *tst_file=fopen(main_test,"rt");
	char file_of_test[300];
	char name_of_test[300];
	char command_line[300];
	int i=0;
	while(!feof(tst_file))
	{
		if(fgets(name_of_test,300,tst_file)!=NULL)	
		{
			fprintf(result_file,"%s\n",name_of_test);
			fclose(result_file);
			fgets(file_of_test,300,tst_file);
			sprintf(file_of_test,"%06d.tst",i);
			sprintf(command_line,"copy result.txt+%s result.txt /Y",file_of_test);
			system(command_line);
			result_file=fopen(result_filename,"a+t");
			fprintf(result_file,"\n");
			i++;
		}
	}
	fclose(result_file);
	return 0;
}

